package com.terracloud.server.dao.sql.device;

import com.terracloud.server.common.data.DeviceGroup;
import com.terracloud.server.dao.model.sql.DeviceGroupRelationEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Collection;
import java.util.List;
import java.util.UUID;

/**
 *
 * @author chenhainan
 * @since 2025/10/11
 */
public interface DeviceGroupRelationRepository extends JpaRepository<DeviceGroupRelationEntity, UUID> {

    List<DeviceGroupRelationEntity> findAllByDeviceGroupId(@Param("deviceGroupId") UUID deviceGroupId);

    long countByDeviceGroupId(@Param("deviceGroupId") UUID deviceGroupId);

    void deleteByDeviceGroupId(@Param("deviceGroupId") UUID deviceGroupId);

    void removeAllByDeviceGroupIdIsAndDeviceIdIn(UUID deviceGroupId, Collection<UUID> deviceId);

}
